The essential steps to create a function/procedure are:
On the Model tab, select Functions in the Model pane.
Click
.
Function Wizard will pop up and it allows you to create a function/procedure easily.
Click Finish.
A tab will open for you to edit the function/procedure.